home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / mxlibs / smix118 / wav2raw.pas < prev    next >
Pascal/Delphi Source File  |  1995-04-19  |  1KB  |  35 lines

  1. {       SMIX is Copyright 1995 by Ethan Brodsky.  All rights reserved.       }
  2. {$R-} {$Q-} {$S-} {Speed it up a bit}
  3. program Wav2Raw;
  4.   const
  5.     BlockSize = 32000;
  6.   var
  7.     InFile, OutFile: file;
  8.     Header: array[1..44] of byte;
  9.     InData:  array[0..BlockSize] of byte;
  10.     OutData: array[0..BlockSize] of ShortInt;
  11.     BytesRead: word;
  12.     i: word;
  13.   begin
  14.     if ParamCount <> 1
  15.       then
  16.         begin
  17.           writeln('SYNTAX:');
  18.           writeln('  WAV2RAW filename');
  19.           writeln('Will convert filename.wav to filename.raw');
  20.           writeln('Must be an 8-bit WAV sampled at 22050 HZ');
  21.           Halt(255);
  22.         end;
  23.     Assign(InFile,  ParamStr(1) + '.WAV');  Reset(InFile,    1);
  24.     Assign(OutFile, ParamStr(1) + '.RAW');  ReWrite(OutFile, 1);
  25.  
  26.     BlockRead(InFile, Header, SizeOf(Header));
  27.     repeat
  28.       BlockRead(InFile, InData, BlockSize, BytesRead);
  29.       for i := 1 to BytesRead do
  30.         OutData[i] := InData[i] - $80;
  31.       BlockWrite(OutFile, OutData, BytesRead);
  32.     until BytesRead = 0;
  33.  
  34.     Close(InFile);  Close(OutFile);
  35.   end.